/* ElmGen - DSP Development Tool
 * Copyright (C)2011 - Andrew Kilpatrick
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 	
 */
package org.andrewkilpatrick.elmGen.test.simTest;
import org.andrewkilpatrick.elmGen.ElmProgram;
public class Bypass extends ElmProgram {
	int sigin = REG0;
	int cur_level   = REG1;
	int level  = REG2;
	int delay  = REG3;
	int pre_delay  = REG4;
	int var = REG5;
	int val = REG6;

	public Bypass() 
	{
		super("Bypass");
		setSamplerate(44000);
		
		clear();
		readRegister(ADCL, 1);
		maxx(cur_level, 1.0);
		writeRegister(cur_level, 0.0);
		
		
		clear();
		readRegister(pre_delay, 1.0);
		scaleOffset(1.0, 0.2);
		writeRegister(pre_delay, 1.0);
		scaleOffset(1.0, -0.999);
		skip(SKP_NEG, 21);
		clear();
		writeRegister(pre_delay, 0.0);
		readRegister(delay, 1.0);
		scaleOffset(1.0, 0.001);  //0.0001 	
		writeRegister(delay, 1.0);
		scaleOffset(1.0, -0.999);
		skip(SKP_NEG, 14);
		clear();
		readRegister(cur_level, -1.0);
		readRegister(level, 1.0);
		writeRegister(var, 1.0);
		scaleOffset(-1.0, 0.5);
		skip(SKP_NEG, 3);
		clear();
		readRegister(cur_level, 1.0);
		writeRegister(val, 0.0);
		clear();
		readRegister(cur_level, 1.0);
		writeRegister(level, 0.0);
		writeRegister(cur_level, 0.0);
		writeRegister(delay, 0.0);
		
		
		
		clear();
		readRegister(var, 1.0);
		writeRegister(DACL, 0.0);
		readRegister(ADCL, 1.0);
		writeRegister(DACR, 0.0);
	}
}
